#include<bits/stdc++.h>
using namespace std;
int s[100000];
void wushi(int s[100000],int n)
{
    int a=0,b=0;
    for(int i=0;i<n;i+=1)
    {
        if(s[i]==1) a+=1;
        else
        {
            b=n-a;
            break;
        }
    }
    if(a>=b) cout<<n-b;
    else cout<<b;
}
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n;
    cin>>n;
    for(int i=0;i<n;i+=1)
    {
        int x;
        cin>>x;
        s[i]=x;
    }
    sort(s,s+n);
    if(s[n-1]<=2)
    {
        wushi(s,n);
    }
    else
    {
        srand(time(0));
        int mm=rand()%n;
        if(mm!=0) cout<<mm;
        else cout<<n/2;
    }
    return 0;
}
